package com.ruoyi.project.system.record.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.record.mapper.TFollowUpRecordMapper;
import com.ruoyi.project.system.record.domain.TFollowUpRecord;
import com.ruoyi.project.system.record.service.ITFollowUpRecordService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 随访记录Service业务层处理
 *
 * @author
 * @date 2021-03-31
 */
@Service
public class TFollowUpRecordServiceImpl implements ITFollowUpRecordService
{
    @Autowired
    private TFollowUpRecordMapper tFollowUpRecordMapper;

    /**
     * 查询随访记录
     *
     * @param id 随访记录ID
     * @return 随访记录
     */
    @Override
    public TFollowUpRecord selectTFollowUpRecordById(Long id)
    {
        return tFollowUpRecordMapper.selectTFollowUpRecordById(id);
    }

    /**
     * 查询随访记录列表
     *
     * @param tFollowUpRecord 随访记录
     * @return 随访记录
     */
    @Override
    public List<TFollowUpRecord> selectTFollowUpRecordList(TFollowUpRecord tFollowUpRecord)
    {
        return tFollowUpRecordMapper.selectTFollowUpRecordList(tFollowUpRecord);
    }

    /**
     * 新增随访记录
     *
     * @param tFollowUpRecord 随访记录
     * @return 结果
     */
    @Override
    public int insertTFollowUpRecord(TFollowUpRecord tFollowUpRecord)
    {
        tFollowUpRecord.setCreateTime(DateUtils.getNowDate());
        return tFollowUpRecordMapper.insertTFollowUpRecord(tFollowUpRecord);
    }

    /**
     * 修改随访记录
     *
     * @param tFollowUpRecord 随访记录
     * @return 结果
     */
    @Override
    public int updateTFollowUpRecord(TFollowUpRecord tFollowUpRecord)
    {
        tFollowUpRecord.setUpdateTime(DateUtils.getNowDate());
        return tFollowUpRecordMapper.updateTFollowUpRecord(tFollowUpRecord);
    }

    /**
     * 删除随访记录对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTFollowUpRecordByIds(String ids)
    {
//        return tFollowUpRecordMapper.deleteTFollowUpRecordByIds(Convert.toStrArray(ids));
        return 1;
    }

    /**
     * 删除随访记录信息
     *
     * @param id 随访记录ID
     * @return 结果
     */
    @Override
    public int deleteTFollowUpRecordById(Long id)
    {
        return tFollowUpRecordMapper.deleteTFollowUpRecordById(id);
    }

    /**
     * 根据疾病ID查询其随访次数
     * @param id
     * @return
     */
    @Override
    public int selectCountByDiseaseId(Long id) {
        return tFollowUpRecordMapper.selectCountByDiseaseId(id);
    }
}
